<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
    public function up(): void
    {
        Schema::create('channel_wechat_offices', function (Blueprint $table) {
            $table->id();
            $table->string('channel_appid', 32)->comment('渠道appid');
            $table->string('appid', 32)->comment('公众号 appid');
            $table->string('appsecret', 128)->comment('公众号 appsecret');
            $table->string('token', 128)->default('')->comment('公众号 token');
            $table->string('aes_key', 128)->default('')->comment('公众号 aes_key');
            $table->timestamps();
            $table->unique('channel_appid', 'unique_channel');
            $table->index('appid', 'idx_appid');
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('channel_wechat_offices');
    }
};
